package com.pensar.tabkids.student.festivalsstudentapp;

import java.util.ArrayList;

import android.R.color;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;



public class TextViewAdapter extends BaseAdapter{
	private Context context;
    private final ArrayList<String> textViewValues;
    TextView textView;

    public TextViewAdapter(Context context, ArrayList<String> textViewValues) {
        this.context = context;
        this.textViewValues = textViewValues;
    }

    public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View gridView;

        if (convertView == null) {

            gridView = new View(context);

            // get layout from mobile.xml
            gridView = inflater.inflate(R.layout.item, null);

            // set value into textview
           textView = (TextView) gridView
                    .findViewById(R.id.grid_item_label);
            textView.setText(textViewValues.get(position)); 
            textView.setBackgroundColor(Color.parseColor("#ffe0b2"));
         
        } else {
            gridView = (View) convertView;
        }

        return gridView;
    }

    public TextView getTextView() {
		return textView;
	}

	public void setTextView(TextView textView) {
		this.textView = textView;
	}

	@Override
    public int getCount() {
        return textViewValues.size();
    }

    @Override
    public Object getItem(int position) {
        return textViewValues.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

}
